package com.springboot.cloud.demos.ribbon.rest;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.demos.entity.form.MomentSupportForm;
import com.springboot.cloud.demos.entity.po.MomentSupport;
import com.springboot.cloud.demos.ribbon.service.MomentSupportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class MomentSupportController {

    @Autowired
    private MomentSupportService momentSupportService;


    @PostMapping("/momentSupport")
    public Result add(@RequestBody MomentSupportForm momentSupportForm) {
        return momentSupportService.save(momentSupportForm);
    }

    @DeleteMapping("/momentSupport/{id}")
    public Result delete(@PathVariable(value="id") String id) {
        return momentSupportService.delete(id);
    }

    @GetMapping("/momentSupport/queryByUser")
    public Result<MomentSupport> queryByUser(@RequestParam("userId") String userId, @RequestParam("type") Integer type, @RequestParam("momentId") String momentId) {
        return momentSupportService.queryByUser(userId,type, momentId);
    }

    @GetMapping("/momentSupport/querySignUpList")
    public Result querySignUpList(@RequestParam("momentId") String momentId) {
        return momentSupportService.querySignUpList(momentId);
    }
}
